<?php 
 session_start();
 header("content-type:text/html;charset=utf-8");
  include "admin/config/mysql.php";
  $username=$_SESSION["username"];
  $id=$_GET['id'];
  $kid=$_GET['kid'];

  $re4=$pdo->query("select id from article_content where kid=$kid and id<$id  order by id desc limit 1");
  $res4=$re4->fetch(PDO::FETCH_ASSOC);
  $prv_id=$res4["id"];

  $re3=$pdo->query("select id from article_content where kid=$kid and id>$id  limit 1");
  $res3=$re3->fetch(PDO::FETCH_ASSOC);
  $next_id=$res3["id"];
 
  var_dump($res3);

  $re=$pdo->query("select * from article_content  where id=$id");
  $res=$re->fetchAll(PDO::FETCH_ASSOC);
 
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>文章详情页1</title>
<link rel="stylesheet" href="./layui/css/layui.css">
<link rel="stylesheet" href="css/css2.css">
</head>
<body>
  <div class="content">
     <h2><?php echo  $res['0']['title']?></h2>
      <span>发布时间:2017-6-19</span>
     <span>作者:<?php echo $res['0']['author']?></span>
     <div class="content_text">
     &nbsp&nbsp&nbsp &nbsp&nbsp<?php echo $res['0']['content']?>
      &nbsp&nbsp&nbsp &nbsp&nbsp巴黎一直以来都是一个时尚胜地，无数的时尚达人在这里汇聚，讨论着下一季整个世界的流行趋势。那是什么让巴黎有那么多时达人呢，就是因为巴黎的文化底蕴给了人们很多的灵感。谁说一定要去看埃菲尔铁塔和凯旋门，在巴黎来次博物馆之旅也不错啊～<br>
       &nbsp&nbsp&nbsp &nbsp&nbsp一、卢浮宫
     卢浮宫是世界三大博物馆之一，其艺术藏品种类之丰富、艺术价值之高令人难以想象。这里的镇馆三宝是世人皆知的《米洛的维纳斯》、《蒙娜丽莎》和《胜利女神》。卢浮宫不论是内在的藏品还是外在的建筑，都值得一游再游，单单一天当然是无法观赏完的。
      &nbsp&nbsp&nbsp &nbsp&nbsp二、下水道博物馆<br>
     在巴黎还有许多像这样奇奇怪怪的博物馆，下水道博物馆展出了自13世纪巴黎建成第一个下水道系统后，公共卫生设施发展的漫长历史。游客们可以看到巴黎最古老的下水道体系。<br>
      &nbsp&nbsp&nbsp &nbsp&nbsp三、国际香水博物馆
    香水博物馆是由法国香水及香精品牌Fragonard开办的，博物馆位于一栋1860年建成的楼房中，楼上是博物馆，楼下是售卖Fragonard品牌香水的门店。博物馆展出了香水的几种制作过程、制作器具、制作原料以及各种不同香调的固体香膏，还有各种风格的古董级香水瓶子。爱好香水的朋友绝对不能错过的一个地方！ 
     </div>
       <a href="index.php?kid=<?php echo $kid?>"><span>首页</span> </a>
       <?php
        if($res3==false){
       ?>
        <a href="article.php?id=<?php echo $prv_id?>&&kid=<?php echo $kid?>"><span>上一篇</span> </a> 
       <?php
        }else if($res4==false){
       ?>
         <a href="article.php?id=<?php echo $next_id?>&&kid=<?php echo $kid?>"><span>下一篇
       <?php
        }else{
       ?>
          <a href="article.php?id=<?php echo $prv_id?>&&kid=<?php echo $kid?>"><span>上一篇</span> </a> 
          <a href="article.php?id=<?php echo $next_id?>&&kid=<?php echo $kid?>"><span>下一篇
       <?php
       }
       ?>
     
       
       
      <!-- <a href="article.php?id=<?php echo $next_id?>&&kid=<?php echo $kid?>"><span>下一篇</span> </a>
          <a href="article.php?id=<?php echo $next_id?>&&kid=<?php echo $kid?>"><span>下一篇</span> </a>
      <a href="article.php?id=<?php echo $prv_id?>&&kid=<?php echo $kid?>"><span>上一篇</span> </a>   -->
     <div class="massage">
      留言板,在这里你可以畅所欲言,不过小心被管理员删帖哦;
      <?php
       $tr3=$pdo->query("select * from message where kid=$id and flag=1");
       $str3=$tr3->fetchALL(PDO::FETCH_ASSOC);
       foreach($str3 as $v){
      ?>
      <div class="message">
       <div><?php echo $v["username"]?>:</div>
       <div name="" id="message_liu" style="width: 600px;margin-left: 50px"><?php echo $v["message"]?></div>
       <span><?php echo date("Y-m-d H:i:s",$v["time"])?></span>
      </div>
      <?php
       }
      ?>
      <form action="do/do_message.php" style="margin-left: -40px" method="post">
      
        <div class="layui-form-item layui-form-text">
          <span style="height:15px;display: block"></span>
          <div style="height: 15px"></div>
          <label class="layui-form-label">发表评论</label>
          <div class="layui-input-block" >
            <textarea class="layui-textarea layui-hide" name="content" lay-verify="required" id="LAY_demo_editor" value="" >
            </textarea>
          </div>
          <input type="hidden" name="id" value="<?php echo $id?>">
          <input type="hidden" name="kid" value="<?php echo $kid?>">
          
          <input type="hidden" name="username" value="<?php echo $username?>">
          <input type="hidden" name="title" value="<?php echo  $res['0']['title']?>">
        </div>
        <div class="layui-form-item">
          <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="demo1">发布</button> 
          </div>
        </div>
      </form>
     </div>
  </div>
<script src="./layui/layui.js"></script>
<script>
//JavaScript代码区域
layui.use(['form', 'layedit', 'laydate'], function(){
  var form = layui.form()
  ,layer   = layui.layer
  ,layedit = layui.layedit
  ,laydate = layui.laydate;
    //创建一个编辑器
  var editIndex = layedit.build('LAY_demo_editor');
  })
</script>
</body>
</html>